<template>
    <nut-notify v-model:visible="visible" v-bind="state" />
</template>

<script lang="ts">
export default { name: '' }
</script>

<script lang="ts" setup>
import { ref, reactive } from 'vue'

const visible = ref(false)

const state = reactive({
    msg: '',
    type: 'primary'
})

const $error = (msg: string) => {
    state.type = 'danger'
    state.msg = msg
    visible.value = true
}

const $info = (msg: string) => {
    state.type = 'primary'
    state.msg = msg
    visible.value = true
}

const $success = (msg: string) => {
    state.type = 'success'
    state.msg = msg
    visible.value = true
}

const $warning = (msg: string) => {
    state.type = 'primary'
    state.msg = msg
    visible.value = true
}


defineExpose({
    $error,
    $info,
    $success,
    $warning
})
</script>
<style lang="scss" scoped>

</style>